(function (exports) {
    var Hero008 = FightHero.extend({
        ctor: function (para) {
            this._super(para);

            return true;
        },
        atk: function(skill, enemyHero, func){
            var that = this;
            this.hero.addAnimation(0, skill, false);

            this.hero.setEventListener(function(trackIndex, event) {
                console.log("hero==" + event.data.name);
                if (event.data.name == 'onAtkDone') {//onAtkDone

                    that.playAnimation(0, 'idle', true);

                    enemyHero.getHero().clearTracks();
                    enemyHero.getHero().addAnimation(2, 'atkd', false);
                    enemyHero.getHero().addAnimation(0, 'idle', true);
                    enemyHero.bloodAni(-10);
                    enemyHero.blueAni(20);

                    if(func)  func();
                }
            })
        },
        atk0: function(skill, enemyHero, func){
            var that = this;
            this.hero.addAnimation(0, skill, false);

            var skillArrName = SkillConfig[that.heroname][skill];

            this.hero.setEventListener(function(trackIndex, event) {
                console.log("hero==" + event.data.name)
                if (event.data.name == 'onAtk0Done') {//onAtkDone
                    var skillspine2 = new sp.SkeletonAnimation('res/image/effect/' + that.heroname + '/' + skillArrName + '.json',
                        'res/image/effect/' + that.heroname + '/' + skillArrName + '.atlas');
                    enemyHero.addChild(skillspine2);
                    skillspine2.addAnimation(0, 'atk0', false);

                    skillspine2.setEventListener(function (trackIndex, event) {
                        console.log('skill008atk0==' + event.data.name);
                        if (event.data.name == 'onAtk0Done') {//onAtkDone

                            that.playAnimation(0, 'idle', true);
                            that.blueAni(-100);

                            enemyHero.getHero().clearTracks();
                            enemyHero.getHero().addAnimation(2, 'atkd', false);
                            enemyHero.getHero().addAnimation(0, 'idle', true);
                            enemyHero.bloodAni(-40);
                            enemyHero.blueAni(40);

                            if(func)  func();
                        }
                    });
                }
            })
        },
        atk1: function(skill, enemyHero){
            var that = this;
            this.hero.addAnimation(0, skill, false);

            this.hero.setEventListener(function(trackIndex, event) {
                console.log("hero==" + event.data.name)
                if (event.data.name == 'onAtk1Done') {//onAtkDone
                    enemyHero.getHero().clearTracks();
                    enemyHero.getHero().addAnimation(2, 'atkd', false);
                    enemyHero.getHero().addAnimation(0, 'idle', true);
                    enemyHero.bloodAni(-10);
                }
            })
        },
        atk2: function(skill, enemyHero){
            var that = this;
            this.hero.addAnimation(0, skill, false);

            this.hero.setEventListener(function(trackIndex, event) {
                console.log("hero==" + event.data.name)
                if (event.data.name == 'onAtk2Done') {//onAtkDone
                    enemyHero.getHero().clearTracks();
                    enemyHero.getHero().addAnimation(2, 'atkd', false);
                    enemyHero.getHero().addAnimation(0, 'idle', true);
                    enemyHero.bloodAni(-10);
                }
            })
        },
    });
    exports.Hero008 = Hero008;
})(window);
